﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Clock
{
    public class People
    {
        public MyClock clock = new MyClock();

        public People()
        {
            clock.OnTick += Clock_OnTick;
            clock.OnAlarm += Clock_OnAlarm;
        }

        private void Clock_OnAlarm(object sender, EventArgs args)
        {
            if (args.time <= DateTime.Now)
            {
                Console.WriteLine($"Alarming!It is {args.time}.");
                clock.isOpen = false;
            }
        }

        private void Clock_OnTick(object sender, EventArgs args)
        {
            Console.WriteLine($"Ticking!It is {args.time}");
        }
    }
}
